#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#define D2D_REQUIRES_SCENE_POSITION
#include "d2d1effecthelpers.hlsli"


//半径
float radius;
float amount;
//位置
float2 position;


D2D_PS_ENTRY(main) {

    //当前位置
    float2 cPoint = D2DGetScenePosition().xy;
    //获取当前点到水波点的距离
    float dist = distance(position,cPoint);
    if(amount==0){
        return D2DGetInput(0);
    }
    else if(radius >= dist){

        float2 dPos = cPoint-position;

        float2 pos =float2(0,0) ;
        
        float scaleFactor=1-(dist/radius);
        //膨胀/挤压
        scaleFactor = 1 - amount * scaleFactor;
        pos = mul(scaleFactor,dPos)+position;

        return D2DSampleInputAtPosition(0,pos);

    }
    else{
        return D2DGetInput(0);
    }

}



